package com.zmn.plat.common.dictionary;

/**
 * 渠道门户显示订单枚举
 *
 * @author ligang
 * @since 2021-10-19 18:07:17
 */
public enum ChannelPortalDisplayOrderEnum {
    /**
     * 渠道门户显示订单 1:下单渠道 2:来源渠道
     */
    ORDER_CHANNEL(ChannelPortalDisplayOrderEnum.DISPLAY_PLACE_AN_ORDER, "下单渠道"),
    SOURCES(ChannelPortalDisplayOrderEnum.DISPLAY_SOURCES, "来源渠道");

    /**
     * 下单渠道
     */
    public final static int DISPLAY_PLACE_AN_ORDER = 1;
    /**
     * 来源渠道
     */
    public final static int DISPLAY_SOURCES = 2;

    private Integer code;
    private String name;

    ChannelPortalDisplayOrderEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getName(Integer code) {
        ChannelPortalDisplayOrderEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelPortalDisplayOrderEnum of(Integer code) {
        switch (code) {
            case 1:
                return ORDER_CHANNEL;
            case 2:
                return SOURCES;
            default:
                return null;
        }
    }
}
